package hjj.service;

import dao.impl.DeptDAOImpl;
import model.Dept;
import util.Page;

public class DeptManager {
	DeptDAOImpl deptdaoimpl = new DeptDAOImpl();

	public Page<Dept> getAllDept(int pageNo, int pageSize) {
		return deptdaoimpl.getAllDept(pageNo, pageSize);
	}

	public Page<Dept> getDeptByName(int pageNo, int pageSize, String deptname) {
		return deptdaoimpl.getDeptByName(pageNo, pageSize, deptname);
	}

	public Page<Dept> getDeptByHeaderName(int pageNo, int pageSize,
			String headerame) {
		int headerid = deptdaoimpl.getDeptID(headerame);
		return deptdaoimpl.getDeptByHeaderId(pageNo, pageSize, headerid);
	}

	public Page<Dept> getDeptByStatus(int pageNo, int pageSize, String Status) {
		if ("可用".equals(Status)) {
			return deptdaoimpl.getDeptByStatus(pageNo, pageSize, true);
		} else {
			return deptdaoimpl.getDeptByStatus(pageNo, pageSize, false);
		}
	}
	public Dept getDeptByName(String name){
		return deptdaoimpl.getDeptByName(name);
	}
}
